//
//  SJPCureMethodViewController.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/9.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SJPCureMethodViewController.h"

@interface SJPCureMethodViewController ()
@property (strong,nonatomic) NSArray* cureList;
@end
static NSString* cell_ID = @"cell_ID";
@implementation SJPCureMethodViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor yellowColor];
    self.title = @"治疗方式";
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cell_ID];
    [self loadData];
}

#pragma
#pragma-数据加载
- (void)loadData
{
  _cureList = @[@"手术治疗",@"药物治疗",@"保守治疗"];
}

#pragma
#pragma-数据源方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _cureList.count;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cell_ID forIndexPath:indexPath];
    cell.textLabel.text = _cureList[indexPath.row];
    return cell;
}
#pragma
#pragma-代理方法实现数据回传
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(self.titleBlock)
        
    {
        self.titleBlock(_cureList[indexPath.row]);
        [self.navigationController popViewControllerAnimated:YES];
    }
}
@end
